package com.xoomworks.rsfr.model;

import java.io.Serializable;
import java.util.Date;

/**
 * The persistent class for the ResourceHistory database table.
 */
public class ResourceHistory extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    private Date createdOn;

    private String description;

    private Date modifiedOn;

    private String positionHeld;

    private Date projectEndDate;

    private Date projectStartDate;

    private String responsabilities;

    private String technologiesUsed;

    // uni-directional many-to-one association to User
    private User createdBy;

    // bi-directional many-to-one association to User
    private User modifiedBy;

    // uni-directional many-to-one association to Resource
    private Resource resource;


    /**
     * Constructor with no fields.
     */
    public ResourceHistory() {
    }

    /**
     * Constructor with specified parameters.
     * @param createdOn Date Represents the data when the resource history was created.
     * @param description String Represents the body of the resource history.
     * @param modifiedOn Date Represents the data when the resource history was modified.
     * @param positionHeld String Represents the position held by the resource.
     * @param projectEndDate Date Represents the date when the project ends.
     * @param projectStartDate Date Represents the date when the project starts.
     * @param responsabilities String Represents the responsibilities of the resource.
     * @param technologiesUsed String Represents the technologies use in the project.
     * @param createdBy User Represents the user who created the resource history.
     * @param resource User.
     */
    public ResourceHistory(final Date createdOn, final String description, final Date modifiedOn,
            final String positionHeld, final Date projectEndDate, final Date projectStartDate,
            final String responsabilities, final String technologiesUsed, final User createdBy,
            final Resource resource) {
        super();
        this.createdOn = createdOn;
        this.description = description;
        this.modifiedOn = modifiedOn;
        this.positionHeld = positionHeld;
        this.projectEndDate = projectEndDate;
        this.projectStartDate = projectStartDate;
        this.responsabilities = responsabilities;
        this.technologiesUsed = technologiesUsed;
        this.createdBy = createdBy;
        this.resource = resource;
    }

    /**
     *Gets the date when the resource history was created.
     * @return createdOn Date Represents the date when the resource history was created.
     */
    public Date getCreatedOn() {
        return this.createdOn;
    }

    /**
     * Sets the date when the resource history was created.
     * @param createdOn Date Which is used to set the createdOn.
     */
    public void setCreatedOn(final Date createdOn) {
        this.createdOn = createdOn;
    }

    /**
     * Gets the body of history.
     * @return description String Represents the body of history.
     */
    public String getDescription() {
        return this.description;
    }

    /**
     * Sets the body of history.
     * @param description String Which is used to set the description.
     */
    public void setDescription(final String description) {
        this.description = description;
    }

    /**
     * Gets the date when the resource history was modified.
     * @return modifiedOn Date Represents the date when the resource history was modified.
     */
    public Date getModifiedOn() {
        return this.modifiedOn;
    }

    /**
     * Sets the date when the resource history was modified.
     * @param modifiedOn Date Which is used to set the modifiedOn.
     */
    public void setModifiedOn(final Date modifiedOn) {
        this.modifiedOn = modifiedOn;
    }

    /**
     * Gets the position held.
     * @return positionHeld String Represents the position held by the resource.
     */
    public String getPositionHeld() {
        return this.positionHeld;
    }

    /**
     * Sets the position held.
     * @param positionHeld String Which is used to set the positionHeld.
     */
    public void setPositionHeld(final String positionHeld) {
        this.positionHeld = positionHeld;
    }

    /**
     * Gets the project end date.
     * @return projectEndDate Date Represents the project end date.
     */
    public Date getProjectEndDate() {
        return this.projectEndDate;
    }

    /**
     * Sets the project end date.
     * @param projectEndDate Date Which is used to set the projectEndDate.
     */
    public void setProjectEndDate(final Date projectEndDate) {
        this.projectEndDate = projectEndDate;
    }

    /**
     * Gets the project start date.
     * @return projectStartDate Date Represents Gets the project start date.
     */
    public Date getProjectStartDate() {
        return this.projectStartDate;
    }

    /**
     * Sets the project start date.
     * @param projectStartDate Date Which is used to set the projectStartDate.
     */
    public void setProjectStartDate(final Date projectStartDate) {
        this.projectStartDate = projectStartDate;
    }

    /**
     * Gets the responsabilities.
     * @return responsabilities String Represents the responsabilities.
     */
    public String getResponsabilities() {
        return this.responsabilities;
    }

    /**
     * Sets the responsabilities.
     * @param responsabilities String Which is used to set the responsibilities.
     */
    public void setResponsabilities(final String responsabilities) {
        this.responsabilities = responsabilities;
    }

    /**
     * Gets the technologies used.
     * @return technologiesUsed String Represents the technologies used.
     */
    public String getTechnologiesUsed() {
        return this.technologiesUsed;
    }

    /**
     * Sets the technologies used.
     * @param technologiesUsed String Which is used to set the technologiesUsed.
     */
    public void setTechnologiesUsed(final String technologiesUsed) {
        this.technologiesUsed = technologiesUsed;
    }

    /**
     * Gets the user who created the resource history.
     * @return createdBy User Represents the user who created the resource history.
     */
    public User getCreatedBy() {
        return this.createdBy;
    }

    /**
     * Sets the user who created the resource history.
     * @param createdBy User Which is used to set the createdBy.
     */
    public void setCreatedBy(final User createdBy) {
        this.createdBy = createdBy;
    }

    /**
     * Gets the user who modified the resource history.
     * @return modifiedBy User Represents the user who modified the resource history.
     */
    public User getModifiedBy() {
        return this.modifiedBy;
    }

    /**
     * Sets the user who modified the resource history.
     * @param modifiedBy User Which is used to set the modifiedBy.
     */
    public void setModifiedBy(final User modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    /**
     * Gets the resource.
     * @return resource Resource Represents the resource
     */
    public Resource getResource() {
        return this.resource;
    }

    /**
     * Sets the resource.
     * @param resource Resource Which is used to set the resource.
     */
    public void setResource(final Resource resource) {
        this.resource = resource;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = (prime * result)
                + ((description == null) ? 0 : description.hashCode());
        result = (prime * result)
                + ((positionHeld == null) ? 0 : positionHeld.hashCode());
        result = (prime * result)
                + ((projectEndDate == null) ? 0 : projectEndDate.hashCode());
        result = (prime
                * result)
                + ((projectStartDate == null) ? 0 : projectStartDate.hashCode());
        result = (prime
                * result)
                + ((responsabilities == null) ? 0 : responsabilities.hashCode());
        result = (prime
                * result)
                + ((technologiesUsed == null) ? 0 : technologiesUsed.hashCode());
        return result;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        ResourceHistory other = (ResourceHistory) obj;
        if (description == null) {
            if (other.description != null) {
                return false;
            }
        } else if (!description.equals(other.description)) {
            return false;
        }
        if (positionHeld == null) {
            if (other.positionHeld != null) {
                return false;
            }
        } else if (!positionHeld.equals(other.positionHeld)) {
            return false;
        }
        if (projectEndDate == null) {
            if (other.projectEndDate != null) {
                return false;
            }
        } else if (!projectEndDate.equals(other.projectEndDate)) {
            return false;
        }
        if (projectStartDate == null) {
            if (other.projectStartDate != null) {
                return false;
            }
        } else if (!projectStartDate.equals(other.projectStartDate)) {
            return false;
        }
        if (responsabilities == null) {
            if (other.responsabilities != null) {
                return false;
            }
        } else if (!responsabilities.equals(other.responsabilities)) {
            return false;
        }
        if (technologiesUsed == null) {
            if (other.technologiesUsed != null) {
                return false;
            }
        } else if (!technologiesUsed.equals(other.technologiesUsed)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ResourceHistory [createdOn=" + createdOn + ", description=" + description
                + ", modifiedOn=" + modifiedOn + ", positionHeld=" + positionHeld
                + ", projectEndDate=" + projectEndDate + ", projectStartDate=" + projectStartDate
                + ", responsabilities=" + responsabilities + ", technologiesUsed="
                + technologiesUsed + ", createdBy=" + createdBy + ", modifiedBy=" + modifiedBy
                + ", resource=" + resource + "]";
    }

}
